// 导出vue的插件 在main.js中被使用
import store from '@/store/index'

export default {
  install(Vue) {
    Vue.directive('allow', {
      inserted: function(el, binding) {
        const points = store.state.user.setUserInfo.roles.points
        // points有binding.value则显示
        if (points.includes(binding.value)) {
          console.log('判断这个元素是否会显示', el, binding.value)
        } else {
          el.parentNode.removeChild(el)
        }
      }
    })
  }
}
